package cool.taomu.box.guice

import com.google.inject.Guice
import cool.taomu.box.guice.ann.Binder
import org.junit.Test
import static org.junit.Assert.assertTrue

class A2 {
	def p() {
		return a();
	}

	private def a() {
		return "Hello World"
	}
}

@Binder(bind=A2, to=A2)
class GuiceTest2 {
	@Test
	def void 生成子类() {
		var tgm = new TaomuGuiceModule();
		var module = tgm.build(GuiceTest2);
		var gc = Guice.createInjector(module);
		var res = gc.getInstance(A2).p();
		assertTrue(res.equals("Hello World"))
	}
}
